<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@ page import="javax.portlet.*"%>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>

<portlet:defineObjects />
<%PortletPreferences prefs = renderRequest.getPreferences();%>
<% PortletSession pSession = renderRequest.getPortletSession();%>

<jsp:useBean id="main" class="com.test.Portal168"/>

<% String[] inputs = (String[]) pSession.getAttribute("inputKeys");%>
<% String[] descriptions = (String[]) pSession.getAttribute("inputDescriptions");%>
<% String[] examples = (String[]) pSession.getAttribute("inputExamples");%>


<style type="text/css">q {color:#3366CC; font-size:22px}r {color:#666666;}r.value {font-style:italic;color:#666666} table, td{border:0px solid black;}td{padding:4px;}</style>
<%if (pSession.getAttribute("workflow") != null) {%>
<q><%=pSession.getAttribute("workflow")%></q>
<br/>
<b><r class="value"><%=pSession.getAttribute("description")%></r></b>
<br/><br/>
<form method="post" action="<portlet:actionURL/>">

    <table>
        <% for (int i = 0; i < inputs.length; i++) {%>
        <tr><td><b><%=inputs[i]%></b></td><td><INPUT type="text" name="<%=inputs[i]%>" size="20"></td></tr>
        <tr><td><r>Description</r></td><td><r class="value"><%=descriptions[i]%></r></td></tr>
        <tr><td><r>Example</r></td><td><r class="value"><%=examples[i]%></r></td></tr>
        <%}%>
    </table>
    <INPUT type="submit" value="Run">
</form>
<br/>
<hr/>
<%}%>
<form method="post" action="<portlet:actionURL/>">
    Select a workflow:
    <select name="workflow">
        <option value="Get cities in country">Get cities in country</option>
        <option value="Counter">Counter</option>
        <option value="Get locations by postcode">Get locations by postcode</option>
    </select>

    <BR>
    <INPUT type="submit" value="Go">
    <br/><br/>
    <% if (pSession.getAttribute("jobID") == null) {%>
    <r><b>No workflow runs in this session</b></r>
    <%} else {%>
    <r><b>Last run's job ID: <%= pSession.getAttribute("jobID")%></r></b>
    <%}%>

</form>